const endpoints = (builder) => ({
  GetPosts: builder.query({
    query: () => 'users',
  }),
  GetUsers: builder.query({
    query: () => 'users',
  }),
  GetUserById: builder.query({
    query: (id) => `users/${id}`,
  }),
  CreateUser: builder.mutation({
    query: (newUser) => ({
      url: 'users',
      method: 'POST',
      body: newUser,
    }),
  }),
  UpdateUser: builder.mutation({
    query: ({ id, ...patch }) => ({
      url: `users/${id}`,
      method: 'PATCH',
      body: patch,
    }),
  }),
  DeleteUser: builder.mutation({
    query: (id) => ({
      url: `users/${id}`,
      method: 'DELETE',
    }),
  }),
});

export default endpoints;
